 	
		$(function(){
			$('#homePage').css('background','#535a7e');			
		});	

var num = Math.random();
	num = Math.ceil(num * 9);
	console.log(num);
	$.ajax({
		  url:'../homeinformation/homePageInfoNew',
		  type:'POST', 
		  async:false,
			  success:function(data){
			  $('#video').html('');
		      $('#video').append("<video id='videos' style='position: relative;z-index: 10;' src="+data[0].videos[num]+" type='video/mp4'  autoplay width='100%' height='255px'>");
		  }
	});

		var date=new Date();
		$('#date').text(date.toLocaleDateString());
		
		function getCurrent(){
			var date=new Date(); 
			$('#current').text(date.toLocaleTimeString());
		}
		
		setInterval('getCurrent()',1000);
		

	    function videoNext(){
	    	 $.ajax({
				  url:'../homeinformation/homePageInfo',
				  type:'POST', 
				  async:false,
				  success:function(data){
					  $('#video').html('');
				      $('#video').append("<video id='videos' style='position: relative;z-index: 10;' src="+data[4].videos[num]+" type='video/mp4'  autoplay width='100%' height='255px'>");
				  }
	    	 });
	    }
	    var video = document.getElementById("videos");
	    video.addEventListener("ended", function() { // 对视频播放添加结束事件，播放结束后调用videoNext()方法
	        videoNext();
	        num = Math.random();
	        num = Math.ceil(num * 9); 
	    }, false); 
		var length;
		//获取图片地址
		$.ajax({
			url:'../wetlandManager/findWetlandPictureForBDNew',
			type:'POST',
			success:function(res){
				for(var i=0;i<res.length;i++){
					length=res.length;
			        var nums = Math.random();
			        nums = Math.ceil(nums * length);
					if(i==0){
						$('#image').append("<img src="+res[0]+"   class='active'/'>");

					}
					$('#image').append("<img src="+res[nums]+"  />");
				}
			},
			error:function(e){
				console.log(e); 
			}
		});
		
		//图片轮播
		function slideshow() {
		  var slideshow=document.getElementById("image"),
		  imgs=slideshow.getElementsByTagName("img"), //得到图片们
		  current=0; //current为当前活跃的图片编号
		
		  function slideOff() {
		    imgs[current].className=""; //图片淡出
		  }
		  function slideOn() {
		    imgs[current].className="active"; //图片淡入
		  }
		
		  function changeSlide() { //切换图片的函数
		    slideOff(); //图片淡出
		    current++; //自增1
		    if(current>=length) current=0;
		    slideOn(); //图片淡入
		  }
		  
		  //每2s调用changeSlide函数进行图片轮播
		  var slideon=setInterval(changeSlide,6000);  
		}
	    slideshow();

	    $.ajax({
			  url:'../wetlandManager/protectwetlandHomePageInfoNew',
			  type:'POST', 
			  async:false,
			  success:function(data){
				 for(var i=0;i<data.length;i++){ 
					 if(data[i].picturetype=='line1'){
					  		//保护主体年增长趋势
					  		  var myChart3= echarts.init(document.getElementById('protection_add'));
					  		 var option3 = {
					  				 tooltip: {
					  				        trigger: 'axis',
					  				        axisPointer: {
					  				            lineStyle: {
					  				                color: '#57617B'
					  				            }
					  				        }
					  				    },
					  				    legend: {
					  				       data:data[i].names ,
					  				       textStyle:{
				  								color:'white',
				  								fontsize:'25px'
				  							}
					  				    },
					  				    grid: {
					  				        left: '3%',
					  				        right: '4%',
					  				        bottom: '3%',
					  				        containLabel: true
					  				    },
					  				    xAxis: [{
					  				        type: 'category',
					  				        boundaryGap: false,
					  						axisLine: {
					  		                    show: true,
					  		                    lineStyle:{
					  		                        fontSize:'20px',
					  		                        color:'white'
					  		                    }
					  		            },
					  				        data: data[i].xaxis
					  				    }],
					  				    yAxis: [{
					  				        type: 'value',
					  				        axisTick: {
					  				            show: false
					  				        },
					  				        axisLabel: {
					  				            left: 15,
					  				            textStyle: {
					  				                fontSize: 14
					  				            }
					  				        },
					  						axisLine: {
					  		                    show: true,
					  		                    left: 20,
					  		                    lineStyle:{
					  		                        fontSize:'20px',
					  		                        color:'white'
					  		                    }
					  		            },
					  				        splitLine:{
					  							show: true,
					  							 lineStyle:{
					  										type:'dashed'
					  				                    },
					  							}
					  				    }],
					  				    series: [{
					  				        name: data[i].names[0],
					  				        type: 'line',	
					  				        itemStyle: {
					  				            normal: {
					  				                color: '#a8cb89'
					  				            }
					  				        },
					  				        data: data[i].rawdata[0]
					  				    }, {
					  				        name: data[i].names[1],
					  				        type: 'line',			       
					  				        itemStyle: {
					  				            normal: {
					  				                color: '#9bdcdd'
					  				            }
					  				        },
					  				        data: data[i].rawdata[1]
					  				    }, {
					  				        name: data[i].names[2],
					  				        type: 'line',	     
					  				        itemStyle: {
					  				            normal: {
					  				                color: '#54a1a3'
					  				            }
					  				        },
					  				        data: data[i].rawdata[2]
					  				    }, {
					  				        name: data[i].names[3],
					  				        type: 'line',		      
					  				        itemStyle: {
					  				            normal: {
					  				                color: '#7cb7ea'
					  				            }
					  				        },
					  				        data: data[i].rawdata[3]
					  				    },{
					  				        name: data[i].names[4],
					  				        type: 'line',		        
					  				        itemStyle: {
					  				            normal: {
					  				                color: '#3d80bf'
					  				            }
					  				        },
					  				        data: data[i].rawdata[4]
					  				    },  ]
					  				};
					  		 myChart3.setOption(option3);
					  		}else if(data[i].picturetype=='line2'){
					  			 //湿地面积排名
					  		  var myChart4= echarts.init(document.getElementById('protection_first'));
					  		 var option4 = {			   
					  				 tooltip: {				 
					  					 trigger: 'axis'
					  				    },

					  				    grid: {
					  				        left: '3%',
					  				        right: '4%',
					  				        bottom: '3%',
					  				        containLabel: true
					  				    },
					  				    xAxis: [{
					  				        type: 'category',
					  				        show:true,
					  				        boundaryGap: true,
					  						axisLine: {
					  		                    lineStyle:{
					  		                        fontSize:'20px',
					  		                        color:'white'
					  		                    }
					  		            },
					  				        data: data[i].xaxis
					  				    }],
					  				    yAxis: [{
					  				        type: 'value',
					  				        axisTick: {
					  				            show: false
					  				        },
					  						axisLine: {
					  		                    show: true,
					  		                    lineStyle:{
					  		                        fontSize:'20px',
					  		                        color:'white'
					  		                    }
					  		            },
					  						splitLine:{
					  							show: true,
					  							 lineStyle:{
					  										type:'dashed'
					  				                    },
					  							},
					  				        axisLabel: {
					  				            margin: 10,
					  				            textStyle: {
					  				                fontSize: 14
					  				            }
					  				        },
					  				   
					  				    }],
					  				    series: [{
					  				        name: '(面积)',		
					  				        type: 'line',
					  				        symbol: 'circle',
					  				        areaStyle: {
					  				            normal: {
					  				                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                    offset: 1,
					  				                    color: 'rgba(61,128,223,0)'
					  				                }, {
					  				                    offset: 0,
					  				                    color: 'rgba(84,161,163, 1)'
					  				                }], false),
					  				                shadowColor: 'rgba(0, 0, 0, 0.1)',
					  				                shadowBlur: 10
					  				            },
					  				        },
					  				      itemStyle: {
					  				            normal: {
					  				                color: '#2e87c9'
					  				            }
					  				        },
					  				          data: data[i].rawdata[0],
					  						 label: {
					  				            normal: {
					  				                show: false,
					  				                position: 'top' //值显示
					  				            }
					  				        }		
					  				    }  ]
					  				};
					  		 myChart4.setOption(option4);
					  		}else if(data[i].picturetype=='保护形式'){
					  			var gjsd=[];
					  			var gjzr=[];
					  			var sdbh=[];
					  			var sjsd=[];
					  			var sjzr=[];
					  			for(var key in data[i]){
					  				if(key=='国家湿地公园或试点'){
					  					gjsd=data[i][key];
					  				}else if(key=='国家级自然保护区'){
					  					gjzr=data[i][key];
					  				}else if(key=='湿地保护小区'){
					  					sdbh=data[i][key];
					  				}else if(key=='省级湿地公园'){
					  					sjsd=data[i][key];
					  				}else if(key=='省级自然保护区'){
					  					sjzr=data[i][key];
					  				}
					  			}
					  			console.log(gjsd);
					  			//保护形式图表设置	
					  			var myChart = echarts.init(document.getElementById('protection_grade'));
					  				
					  			option = {
					  				    series: [
					  				             {
					  				               name: '国家级自然保护区',
					  				               type: 'pie',
					  				               radius: ['43%', '48%'],
					  				               center: ['30%', '27%'],
					  				               startAngle: 225,
					  				               color: [new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                   offset: 0,
					  				                   color: '#54a1a3'
					  				               }, {
					  				                   offset: 1,
					  				                   color: '#54a1a3'
					  				               }]), "transparent"],
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                    name: '国家级自然保护区',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '国家级自然\n保护区', 
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 13
					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 75,
					  				                    name: '国家级自然保护区',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+gjzr[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15
					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+gjzr[1]+"公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }
					  				               ]
					  				           },
					  				           {
					  				               name: '省级自然保护区',
					  				               type: 'pie',
					  				               radius: ['43%', '48%'],
					  				               center: ['70%', '27%'],
					  				               startAngle: 225,
					  				               color: [new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                   offset: 0,
					  				                   color: '#54a1a3'
					  				               }, {
					  				                   offset: 1,
					  				                   color: '#54a1a3'
					  				               }]), "transparent"],
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }  
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                    name: '省级自然保护区',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '省级自然保护区',
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 13

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 75,
					  				                    name: '省级自然保护区',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+sjzr[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+sjzr[1]+" 公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }]
					  				           },
					  				            {
					  				               name: '国家湿地公园或试点',
					  				               type: 'pie',
					  				               radius: ['43%', '48%'],
					  				               center: ['16%', '70%'],
					  				               startAngle: 225,
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '国家湿地公园\n或试点',
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 13
					  				                               }
					  				                           }
					  				                       }
					  				               },{
					  				                   value: 75,
					  				                   "itemStyle": {
					  				                       "normal": {
					  				                           "color": new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                               "offset": 0,
					  				                               "color": '#54a1a3'
					  				                           }, {
					  				                               "offset": 1,
					  				                               "color": '#54a1a3'
					  				                           }]),
					  				                       }
					  				                   },
					  				                    name: '国家湿地公园或试点',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+gjsd[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+gjsd[1]+"公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }]
					  				           },
					  				            {
					  				               name: '省级湿地公园',
					  				               type: 'pie',
					  				               radius: ['43%', '48%'],
					  				               center: ['50%', '70%'],
					  				               startAngle: 225,
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '省级湿地公园  ',
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 13

					  				                               }
					  				                           }
					  				                       }
					  				               },{
					  				                   value: 75,
					  				                   "itemStyle": {
					  				                       "normal": {
					  				                           "color": new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                               "offset": 0,
					  				                               "color": '#54a1a3'
					  				                           }, {
					  				                               "offset": 1,
					  				                               "color": '#54a1a3'
					  				                           }]),
					  				                       }
					  				                   },
					  				                    name: '省级湿地公园',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+sjsd[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+sjsd[1]+"公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }]
					  				           },
					  				            {
					  				               name: '湿地保护小区',
					  				               type: 'pie',
					  				               radius: ['43%', '48%'],
					  				               center: ['84%', '70%'],
					  				               startAngle: 225,
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '湿地保护小区  ',
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               },{
					  				                   value: 75,
					  				                   "itemStyle": {
					  				                       "normal": {
					  				                           "color": new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                               "offset": 0,
					  				                               "color": '#54a1a3'
					  				                           }, {
					  				                               "offset": 1,
					  				                               "color": '#54a1a3'
					  				                           }]),
					  				                       }
					  				                   },
					  				                    name: '湿地保护小区',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+sdbh[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+sdbh[1]+"公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }]
					  				           },
					  				       ]
					  			};
					  			 myChart.setOption(option);
					  		}else if(data[i].picturetype=='保护级别'){
					  		  var ybsd=[];
					  		  var gjzy=[];
					  		  var gjsd=[];
					  		  var sjzy=[];
					  		  var sjsd=[];
					  		for(var key in data[i]){
				  				if(key=='一般湿地'){
				  					ybsd=data[i][key];
				  				}else if(key=='国家重要湿地'){
				  					gjzy=data[i][key];
				  				}else if(key=='国际重要湿地'){
				  					gjsd=data[i][key];
				  				}else if(key=='市级重要湿地'){
				  					sjzy=data[i][key];
				  				}else if(key=='省级重要湿地'){
				  					sjsd=data[i][key];
				  				}
				  			}
					  			 //生态物种柱状图
					  		  var myChart5= echarts.init(document.getElementById('protection_area'));
					  		  var option5= {
					  				  series: [
					  				             {
					  				               name: '国际重要湿地',
					  				               type: 'pie',
					  				               radius: ['40%', '45%'],
					  				               center: ['30%', '25%'],
					  				               startAngle: 225,
					  				               color: [new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                   offset: 0,
					  				                   color: '#54a1a3'
					  				               }, {
					  				                   offset: 1,
					  				                   color: '#54a1a3'
					  				               }]), "transparent"],
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                    name: '国际重要湿地',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '国际重要湿地',
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 13
					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 75,
					  				                    name: '国际重要湿地',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+gjsd[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15
					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+gjsd[1]+"公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }
					  				               ]
					  				           },
					  				           {
					  				               name: '国家重要湿地',
					  				               type: 'pie',
					  				               radius: ['40%', '45%'],
					  				               center: ['70%', '25%'],
					  				               startAngle: 225,
					  				               color: [new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                   offset: 0,
					  				                   color: '#54a1a3'
					  				               }, {
					  				                   offset: 1,
					  				                   color: '#54a1a3'
					  				               }]), "transparent"],
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                    name: '国家重要湿地',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '国家重要湿地',
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 13

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 75,
					  				                    name: '国家重要湿地',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+gjzy[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+gjzy[1]+"公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }]
					  				           },
					  				            {
					  				               name: '省级重要湿地',
					  				               type: 'pie',
					  				               radius: ['40%', '45%'],
					  				               center: ['16%', '70%'],
					  				               startAngle: 225,
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '省级重要湿地',
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 13

					  				                               }
					  				                           }
					  				                       }
					  				               },{
					  				                   value: 75,
					  				                   "itemStyle": {
					  				                       "normal": {
					  				                           "color": new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                               "offset": 0,
					  				                               "color": '#54a1a3'
					  				                           }, {
					  				                               "offset": 1,
					  				                               "color": '#54a1a3'
					  				                           }]),
					  				                       }
					  				                   },
					  				                    name: '省级重要湿地',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+sjsd[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+sjsd[1]+"公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }]
					  				           },
					  				            {
					  				               name: '市级重要湿地',
					  				               type: 'pie',
					  				               radius: ['40%', '45%'],
					  				               center: ['50%', '70%'],
					  				               startAngle: 225,
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '市级重要湿地 ',
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 13

					  				                               }
					  				                           }
					  				                       }
					  				               },{
					  				                   value: 75,
					  				                   "itemStyle": {
					  				                       "normal": {
					  				                           "color": new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                               "offset": 0,
					  				                               "color": '#54a1a3'
					  				                           }, {
					  				                               "offset": 1,
					  				                               "color": '#54a1a3'
					  				                           }]),
					  				                       }
					  				                   },
					  				                    name: '市级重要湿地',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+sjzy[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+sjzy[1]+"公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }]
					  				           },
					  				            {
					  				               name: '一般湿地',
					  				               type: 'pie',
					  				               radius: ['40%', '45%'],
					  				               center: ['84%', '70%'],
					  				               startAngle: 225,
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '一般湿地 ',
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 13

					  				                               }
					  				                           }
					  				                       }
					  				               },{
					  				                   value: 75,
					  				                   "itemStyle": {
					  				                       "normal": {
					  				                           "color": new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                               "offset": 0,
					  				                               "color": '#54a1a3'
					  				                           }, {
					  				                               "offset": 1,
					  				                               "color": '#54a1a3'
					  				                           }]),
					  				                       }
					  				                   },
					  				                    name: '一般湿地',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+ybsd[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+ybsd[1]+"公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }]
					  				           },
					  				       ]
					  				};
					  		  myChart5.setOption(option5);
					  		}else if(data[i].picturetype=='保护形式'){
					  			var gjsd=[];
					  			var gjzr=[];
					  			var sdbh=[];
					  			var sjsd=[];
					  			var sjzr=[];
					  			for(var key in data[i]){
					  				if(key=='国家湿地公园或试点'){
					  					gjsd=data[i][key];
					  				}else if(key=='国家级自然保护区'){
					  					gjzr=data[i][key];
					  				}else if(key=='湿地保护小区'){
					  					sdbh=data[i][key];
					  				}else if(key=='省级湿地公园'){
					  					sjsd=data[i][key];
					  				}else if(key=='省级自然保护区'){
					  					sjzr=data[i][key];
					  				}
					  			}
					  			console.log(gjsd);
					  			//保护形式图表设置	
					  			var myChart = echarts.init(document.getElementById('protection_grade'));
					  				
					  			option = {
					  				    series: [
					  				             {
					  				               name: '国家级自然保护区',
					  				               type: 'pie',
					  				               radius: ['43%', '48%'],
					  				               center: ['30%', '27%'],
					  				               startAngle: 225,
					  				               color: [new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                   offset: 0,
					  				                   color: '#54a1a3'
					  				               }, {
					  				                   offset: 1,
					  				                   color: '#54a1a3'
					  				               }]), "transparent"],
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                    name: '国家级自然保护区',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '国家级自然\n保护区', 
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 13
					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 75,
					  				                    name: '国家级自然保护区',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+gjzr[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15
					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+gjzr[1]+"公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }
					  				               ]
					  				           },
					  				           {
					  				               name: '省级自然保护区',
					  				               type: 'pie',
					  				               radius: ['43%', '48%'],
					  				               center: ['70%', '27%'],
					  				               startAngle: 225,
					  				               color: [new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                   offset: 0,
					  				                   color: '#54a1a3'
					  				               }, {
					  				                   offset: 1,
					  				                   color: '#54a1a3'
					  				               }]), "transparent"],
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }  
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                    name: '省级自然保护区',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '省级自然保护区',
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 13

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 75,
					  				                    name: '省级自然保护区',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+sjzr[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+sjzr[1]+" 公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }]
					  				           },
					  				            {
					  				               name: '国家湿地公园或试点',
					  				               type: 'pie',
					  				               radius: ['43%', '48%'],
					  				               center: ['16%', '70%'],
					  				               startAngle: 225,
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '国家湿地公园\n或试点',
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 13
					  				                               }
					  				                           }
					  				                       }
					  				               },{
					  				                   value: 75,
					  				                   "itemStyle": {
					  				                       "normal": {
					  				                           "color": new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                               "offset": 0,
					  				                               "color": '#54a1a3'
					  				                           }, {
					  				                               "offset": 1,
					  				                               "color": '#54a1a3'
					  				                           }]),
					  				                       }
					  				                   },
					  				                    name: '国家湿地公园或试点',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+gjsd[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+gjsd[1]+"公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }]
					  				           },
					  				            {
					  				               name: '省级湿地公园',
					  				               type: 'pie',
					  				               radius: ['43%', '48%'],
					  				               center: ['50%', '70%'],
					  				               startAngle: 225,
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '省级湿地公园  ',
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 13

					  				                               }
					  				                           }
					  				                       }
					  				               },{
					  				                   value: 75,
					  				                   "itemStyle": {
					  				                       "normal": {
					  				                           "color": new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                               "offset": 0,
					  				                               "color": '#54a1a3'
					  				                           }, {
					  				                               "offset": 1,
					  				                               "color": '#54a1a3'
					  				                           }]),
					  				                       }
					  				                   },
					  				                    name: '省级湿地公园',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+sjsd[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+sjsd[1]+"公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }]
					  				           },
					  				            {
					  				               name: '湿地保护小区',
					  				               type: 'pie',
					  				               radius: ['43%', '48%'],
					  				               center: ['84%', '70%'],
					  				               startAngle: 225,
					  				               labelLine: {
					  				                   normal: {
					  				                       show: false
					  				                   }
					  				               },
					  				               label: {
					  				                       normal: {
					  				                           position: 'center'
					  				                       }
					  				                   },
					  				               data: [{
					  				                   value: 0,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: '湿地保护小区  ',
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               },{
					  				                   value: 75,
					  				                   "itemStyle": {
					  				                       "normal": {
					  				                           "color": new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
					  				                               "offset": 0,
					  				                               "color": '#54a1a3'
					  				                           }, {
					  				                               "offset": 1,
					  				                               "color": '#54a1a3'
					  				                           }]),
					  				                       }
					  				                   },
					  				                    name: '湿地保护小区',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n"+sdbh[0]+"个",
					  				                               textStyle: {
					  				                                   color: '#f29b76',
					  				                                   fontSize: 15

					  				                               }
					  				                           }
					  				                       }
					  				               }, {
					  				                   value: 25,
					  				                   name: '%',
					  				                       label: {
					  				                           normal: {
					  				                               formatter: "\n共"+sdbh[1]+"公顷",
					  				                               textStyle: {
					  				                                   color: '#9bdcdd',
					  				                                   fontSize: 12

					  				                               }
					  				                           }
					  				                       }
					  				               }]
					  				           },
					  				       ]
					  			};
					  			 myChart.setOption(option);
					  		}
				 }
			  }
			  });	
	    
	    
			 $.ajax({
				  url:'../homeinformation/homePageInfoNew',
				  type:'POST', 
				  async:false,
				  success:function(data){
					 for(var i=0;i<data.length;i++){
						 if(data[i].picturetype=='pie1'){
						 //生态监测饼图
						  var myChart3= echarts.init(document.getElementById('monitoring'));
						 var option3 = {
								    title : {
								        text: "站点总数："+data[3].numOfSite+"   指标总数："+data[3].numOfIndicator+"   数据采集总数："+data[3].numOfData+"",			      
								        textStyle:{
								        	color:'#fff',
								        	fontSize:13
								        },				     
								        top:0,
								        left:50
								    },
								    tooltip: {
								        trigger: 'item',
								        formatter: "{a} <br/>{b}: {c} ({d}%)"
								    },
								  
								    series: [
								        {
								            name:'监测类型',
								            type:'pie',
								            radius: ['40%', '60%'],
								            center: ['50%','45%'],
								            avoidLabelOverlap: false,
								            label: { 
								                normal: { 
								                    show: true,
								                    
								                },
								                lableLine: {
								                    normal: {
								                        show: true
								                    }
								                  
								                },
								                emphasis: {
								                    show: true,
								                    textStyle: {
								                        fontSize: '12',
								                        fontWeight: 'bold'
								                    }
								                }
								            },
								            labelLine: {
								                normal: {
								                    show: true
								                }
								            },
								            data:[
								                {value:data[i].rawdata[0], name:data[i].names[0],itemStyle:{normal:{color: '#2e87c9'}}},	                
								                {value:data[i].rawdata[1], name:data[i].names[1],itemStyle:{normal:{color: '#77bdf2'}}},
								                {value:data[i].rawdata[2], name:data[i].names[2],itemStyle:{normal:{color: '#849f74'}}},
								                {value:data[i].rawdata[3], name:data[i].names[3],itemStyle:{normal:{color: '#aecf9a'}}}
								            ]
								        }
								    ]
								};
						 myChart3.setOption(option3)
					}	
				 }
					$('#alarm1').append("系统告警："+data[3].numOfSystemAlarm+"条");	
					$('#alarm2').append("数据告警："+data[3].numOfDataAlarm+"条");
					$('#alarm3').append("设备告警："+data[3].numOfDeviceAlarm+"条");
			}
	});   
		 
		 //湿地面积饼图
			 $.ajax({
				  url:'../municipalProfiles/getSubjectAreaByAuthority', 
				  type:'POST', 
				  async:false,
				  success:function(data){
					  var sum=0;
					  var area=data.data.data.ylist;
					  var areaname=data.data.data.xlist;
					  for(var i=0;i<area.length;i++){
						  sum=Number(sum)+Number(area[i]);
					  }
					  var myChart4= echarts.init(document.getElementById('area'));
					  var option4 = {			   
							    tooltip : {
							        trigger: 'item',
							        formatter: "{a} <br/>{b} : {c} ({d}%)"
							    },
							    title : {
							        text: '湿地总面积：'+sum+'（公顷）',			      
							        textStyle:{
							        	color:'#fff',
							        	fontSize:13
							        },				      
							        top:0,
							        left:'30%'
							    },
							    legend: {
							        orient: 'vertical',
							        x: 'left',
							        top:30,
							        left:30,
							        itemGap:30,
							        data:areaname,
							        textStyle:{
							        	color:'#fff',
							        	fontSize:12
							        }
							    },
							    series : [
							        {
							            name: '湿地',
							            type: 'pie',
							            radius : '65%',
							            center: ['75%', '50%'],			           
							            data:[
							                {value:area[0], name:areaname[0],itemStyle:{normal:{color: '#77bdf2'}}},
							                {value:area[1], name:areaname[1],itemStyle:{normal:{color: '#2e87c9'}}},
							                {value:area[2], name:areaname[2],itemStyle:{normal:{color: '#849f74'}}},
							                {value:area[3], name:areaname[3],itemStyle:{normal:{color: '#aecf9a'}}},
							                {value:area[4], name:areaname[4],itemStyle:{normal:{color: '#90b7dc'}}}
							            ],	
							            label: {
							                normal: {
							                    show: false,
							                   
							                },
							               
							            },
							            labelLine: {
							                normal: {
							                    show:false,                  		                    
							                }
							            },
							           
							        }
							    ]
							};
					 myChart4.setOption(option4);	
				  }
			 });
			 
		  

    var longitude;
    var latitude;
    var scale;
    $.ajax({
		  url:'../wetlandManager/calculatecenterandscaleJson',
		  type:'POST', 
		  async:false,
		  success:function(data){
			  longitude=data.longitude;
			  latitude=data.latitude;
			  scale=data.zoom;
		  } 
	 });
	var sites =new Array();
 	var stamen;
//gis地图
	require(["esri/Basemap"], function(Basemap) { 
		
	});
	require([
	"esri/Map",
	"esri/views/MapView",
	"esri/views/ui/UI", 
	"esri/layers/FeatureLayer",
	"esri/Graphic",
	"esri/widgets/BasemapToggle",
	"esri/layers/MapImageLayer",
	"dojo/domReady!"
	], function(Map, MapView,UI, FeatureLayer,Graphic,BasemapToggle,MapImageLayer){  
	  var view;
	  var layer = new MapImageLayer({
		    url: "http://puhouddns.imwork.net:6080/arcgis/rest/services/行政边界1/行政边界1/MapServer/"
		  });
	  var map = new Map({ 
		  basemap:"dark-gray", 
		}); 
	  map.add(layer);
	  
	  function createView(map) {
	       view = new MapView({
	        map: map,
	        container: "map",
	        zoom: scale,  
		    center: [longitude, latitude],
		    popup: {
		          dockEnabled: true,
		          dockOptions: {
		            // Disables the dock button from the popup
		            buttonEnabled: true,
		            // Ignore the default sizes that trigger responsive docking
		            breakpoint: true,
		          }
		        }
	      });
	       
	  }
	createView(map);
	var basemapToggle = new BasemapToggle({
		  view: view,  // The view that provides access to the map's "streets" basemap
		  nextBasemap: "hybrid"  // Allows for toggling to the "hybrid" basemap
		});
	view.ui.add(basemapToggle, "top-right");

	view.popup.set("dockOptions", {
	    breakpoint: true,
	    buttonEnabled: true,
	    position:'top-left'
	  });
	
	function getSiteInfo(target){
		  var result='';
		  $.ajax({
			  url:'../wetlandManager/findbyid',
			  type:'POST',
			  data:{"id":target.graphic.attributes.ID}, 
			  async:false,
			  success:function(res){
				  var data="<p>行政区划: <span class='value'>"+res.wlin_province+res.wlin_city+res.wlin_district+"</span></p>"
				 	+"<p>湿地面积: <span class='value'>"+res.wlin_official_area+"公顷</span></p>"
				 	+"<p>保护体系: <span class='value'>"+res.wlin_protection_level+"</span></p>"
				 	+"<p>管理单位:<span class='value'>"+res.wlin_management_name+"</span></p>";
				 var src="<p><a href='javascript:showinfo(\""+ target.graphic.attributes.ID + "\")'>查看详情</a></p>"
				  result=data+src; 
			  },
			  error:function(err){
				  return err;
			  }
		  });
		  return result;
	} 

	//渲染所有监测点
	$.ajax({
		url:'../wetlandManager/calculatecenterandscaleForBDNew',
		type:'POST',
		success:function(res){
			res.forEach(function(item){ 
				var point=coordtransform.bd09togcj02(item.wlin_longitude,item.wlin_latitude);	
				var points = coordtransform.gcj02towgs84(point[0], point[1]);
				var polyline = {
						 type: "point",  
						 longitude:points[0].toFixed(6),
						 latitude: points[1].toFixed(6)
				  };					
				// Create an object for storing attributes related to the line
				 var lineAtt = {
				          名字: item.wlin_name,
				          ID: item.id,				    
				  };
				 var textSymbol ={
				    	  type: "text",  // autocasts as new TextSymbol()
				    	  color: "white",
				    	  haloColor: "black",
				    	  haloSize: "1px",
				    	  text: item.wlin_name,
				    	  xoffset: 8, 
				    	  yoffset: 10,
				    	  font: {  // autocast as new Font()
				    	    size: 10,
				    	    family: "sans-serif",
				    	    weight: "bolder"
				    	  }
				    };	
		 
				 
				 var polylineGraphic1 = new Graphic({
					geometry: polyline,
				    symbol:{
				    	  type: "simple-marker",  // autocasts as new SimpleMarkerSymbol()
						  color: '#FF4040',
						  outline: { // autocasts as new SimpleLineSymbol()
						  color: [255, 255, 255],
						  width: 2
						  }		
				    },
				    attributes: lineAtt,
				    popupTemplate: {  // autocasts as new PopupTemplate()
						title: "{名字}",
				/*		content: [{
						   type: "fields",
						   fieldInfos: [{fieldName: "名字"}, {fieldName: "ID"}]
						}]   */
						content:getSiteInfo
					 }
				 });
				 
				
				 
				 var polylineGraphic2 = new Graphic({
						geometry: polyline,
					    symbol: {
					    	  type: "simple-marker",  // autocasts as new SimpleMarkerSymbol()
							  color: '#00BFFF',
							  outline: { // autocasts as new SimpleLineSymbol()
							  color: [255, 255, 255],
							  width: 2
							  }		
					    },
					    attributes: lineAtt,
					    popupTemplate: {  // autocasts as new PopupTemplate()
							title: "{名字}",
					/*		content: [{
							   type: "fields",
							   fieldInfos: [{fieldName: "名字"}, {fieldName: "ID"}]
							}]   */
							content:getSiteInfo
						 }
					 });
				 var polylineGraphic3 = new Graphic({
						geometry: polyline,
					    symbol: {
					    	  type: "simple-marker",  // autocasts as new SimpleMarkerSymbol()
							  color: '#00FF00',
							  outline: { // autocasts as new SimpleLineSymbol()
							  color: [255, 255, 255],
							  width: 2
							  }		
					    },
					    attributes: lineAtt,
					    popupTemplate: {  // autocasts as new PopupTemplate()
							title: "{名字}",
					/*		content: [{
							   type: "fields",
							   fieldInfos: [{fieldName: "名字"}, {fieldName: "ID"}]
							}]   */
							content:getSiteInfo
						 }
					 });
				 var polylineGraphic4 = new Graphic({
						geometry: polyline,
					    symbol: {
					    	  type: "simple-marker",  // autocasts as new SimpleMarkerSymbol()
							  color: '#00EEEE',
							  outline: { // autocasts as new SimpleLineSymbol()
							  color: [255, 255, 255],
							  width: 2
							  }		
					    },
					    attributes: lineAtt,
					    popupTemplate: {  // autocasts as new PopupTemplate()
							title: "{名字}",
					/*		content: [{
							   type: "fields",
							   fieldInfos: [{fieldName: "名字"}, {fieldName: "ID"}]
							}]   */
							content:getSiteInfo
						 }
					 });
				 var polylineGraphic5 = new Graphic({
						geometry: polyline,
					    symbol: {
					    	  type: "simple-marker",  // autocasts as new SimpleMarkerSymbol()
							  color: '#B7B7B7',
							  outline: { // autocasts as new SimpleLineSymbol()
								  color: [255, 255, 255],
								  width: 2
							  }
							
					    },
					    attributes: lineAtt,
					    popupTemplate: {  // autocasts as new PopupTemplate()
							title: "{名字}",
					/*		content: [{
							   type: "fields",
							   fieldInfos: [{fieldName: "名字"}, {fieldName: "ID"}]
							}]   */
							content:getSiteInfo
						 }
					 });
				 
				 var polylineGraphics = new Graphic({
						geometry: polyline,
					    symbol:textSymbol,
					    attributes: lineAtt,
					    popupTemplate: {  // autocasts as new PopupTemplate()
							title: "{名字}",
					/*		content: [{
							   type: "fields",
							   fieldInfos: [{fieldName: "名字"}, {fieldName: "ID"}]
							}]   */
							content:getSiteInfo
						 }
					 });
				 view.graphics.add(polylineGraphics);
				if(item.wlin_protection_level=='国际重要湿地'){
					view.graphics.add(polylineGraphic1);
				}else if(item.wlin_protection_level=='国家重要湿地'){
					view.graphics.add(polylineGraphic2);
				}else if(item.wlin_protection_level=='一般湿地'){
					view.graphics.add(polylineGraphic3);
				}else if(item.wlin_protection_level=='市级重要湿地'){
					view.graphics.add(polylineGraphic4);
				}else if(item.wlin_protection_level=='省级重要湿地'){
					view.graphics.add(polylineGraphic5);
				}else if(item.wlin_protection_level=='其它'){
					view.graphics.add(polylineGraphic5);
				} 	 	 				 			
				// Add the line graphic to the view's GraphicsLayer
				
				view.on("mouse-wheel", function(evt){
					 // deltaY value is postive when wheel is scrolled up
					 // and it is negative when wheel is scrolled down.
					 console.log(view.zoom);
						if(view.zoom>=10){
							view.graphics.add(polylineGraphics);
						}else if(view.zoom<=9){
							view.graphics.remove(polylineGraphics);
						}
					}); 

			})
			
		},
		error:function(err){
			console.log(err);
		}
		});  
	function showbywetlandname(wetlandname){
		//根据湿地公园名称获取视频监测点数据
		getsitesbywetlandname(wetlandname);
		//根据湿地公园名称进行地图展示
		showmapbywetlandname(wetlandname);
	}

		$('#select').on('change',function(){
			var wetland=$(this).val();
			var arr=wetland.split('_');
			showbywetlandname(arr[0]);
		});
		
		
		
		/**
		 * 根据湿地公园名称获取视频监测点信息
		 */
		function getsitesbywetlandname(wetlandname) {
			$.ajax({
				url : "../monitoringsite/findsiteinfobywetlandname",
				dataType : "json",
				type : "POST",
				data : {'wetlandname':wetlandname},
				async : false,
				error : function(error) {
					console.log(error.responseText);
					$.gritter.add({
						title : '服务器错误',
						text : '对起，服务器错误，请联系系统管理员！',
						class_name : 'gritter-error'
					});
				},
				success : function(strValue) {
					sites.length = 0;
					for ( var key in strValue) {
						if (strValue[key].show == 1){
							sites.push({
								"longitude" : strValue[key].longitude,
								"latitude" : strValue[key].latitude,
								"id" : key,
								"name" : strValue[key].name,
								"status" : strValue[key].status
							});	
						}
					}
				}
			});
		}

		function showmapbywetlandname(wetlandname) {
			var centerlongitude, centerlatitude, zoom;
			$.ajax({
				url : "../wetlandManager/findbyname",
				dataType : "json",
				type : "POST",
				data : {'name':wetlandname},
				async : false,
				error : function(error) {
					console.log(error.responseText);
					$.gritter.add({
						title : '服务器错误',
						text : '对不起，服务器错误，请联系系统管理员！',
						class_name : 'gritter-error'
					});
				},
				success : function(strValue) {
					centerlongitude = strValue.wlin_longitude;
					centerlatitude = strValue.wlin_latitude;
					view.goTo({
						  center: [centerlongitude, centerlatitude],
						  zoom: 10
						}); 
					
					 var polyline = {
							 type: "point",  
							 longitude: centerlongitude,
							 latitude: centerlatitude
					  };		
					 var textSymbol ={
					    	  type: "text",  // autocasts as new TextSymbol()
					    	  color: "white",
					    	  haloColor: "black",
					    	  haloSize: "1px",
					    	  text: wetlandname,
					    	  xoffset: 8, 
					    	  yoffset: 10,
					    	  font: {  // autocast as new Font()
					    	    size: 10,
					    	    family: "sans-serif",
					    	    weight: "bolder"
					    	  }
					    };	
					 var polylineGraphics = new Graphic({
							geometry: polyline,
						    symbol:textSymbol						  
						 });
					 view.graphics.add(polylineGraphics);
					 
					 view.on("mouse-wheel", function(evt){
							if(view.zoom<=9){
									view.graphics.remove(polylineGraphics);
								}
							}); 


				}
			});
		}
	});
	
	// 启动显示
	function showinfo(id) {
		window.location.href='../wetlandManager/indexnew?id='+id;
	}


		 

	
   
